n = int(input())
a = []
sum_ = 0;
for i in range(n):
    a.append(int(input()))
    sum_ += a[i]

sum_ /= n
answer = 0
for i in range(n):
    a[i] -= sum_

for i in range(n):
    if a[i] != 0:
        a[i + 1] += a[i]
        a[i] = 0
        answer += 1

print()
print(answer)
